<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Route
 *
 * @author Propietario
 */
class Shipment extends AppModel 
{
    public function shipmentsList($limit) 
    {
       /* return $this->query("SELECT DATE_ADD( source_date, INTERVAL effective_days DAY ),
                            shipments.id AS Shipments_Id, 
                            shipments.user_id, 
                            shipments.contact_name, 
                            shipments.source_date,
                            shipments.creation_date,
                            DATE_FORMAT(source_date,GET_FORMAT(DATE, 'EUR')) AS Availability_Date,
                            DATE_FORMAT(DATE_ADD( source_date, INTERVAL effective_days DAY) ,GET_FORMAT(DATE, 'EUR')) AS New_Availability_Date,
                            shipments.effective_days,
                            shipments.contact_phone,
                            shipments.comments AS Comment, 
                            shipments.vehicle_id AS Vehicle_Id, 
                            shipments.vehicle_type_id AS Vehicle_Type_Id, 
                            shipments.municipality_destiny_id, 
                            shipments.state_destiny_id AS StateId, 
                            vehicles.id, 
                            vehicles.name AS Vehicle_Name, 
                            vehicle_types.id, 
                            vehicle_types.name AS Vehicle_Type_Name,
                            states.name AS State_Destiny_Name, 
                            states.abbreviation AS State_D_Abbrev,       
                            states.id, 
                            city.name AS City_Destiny_Name, 
                            city.id_city,
                            statesOrigin.name AS State_Origin_Name,
                            statesOrigin.abbreviation AS State_O_Abbrev,
                            statesOrigin.id, 
                            citiesOrigin.name AS City_Origin_Name,  
                            citiesOrigin.id,
                            zone.name AS Zone_Name, 
                            zone.number AS Zone_Number, 
                            zone.id_city, 
                            zone.id_state
                            FROM shipments
                            LEFT JOIN vehicles ON ( shipments.vehicle_id = vehicles.id )
                            LEFT JOIN vehicle_types ON ( shipments.vehicle_type_id = vehicle_types.id ) 
                            LEFT JOIN states ON ( state_destiny_id = states.id )
                            LEFT JOIN city ON ( municipality_destiny_id = city.id_city )
                            LEFT JOIN states AS statesOrigin ON ( state_Origin_id = statesOrigin.id ) 
                            LEFT JOIN city AS citiesOrigin ON ( municipality_Origin_id = citiesOrigin.id)
                            LEFT JOIN zone ON (zone.id_city = municipality_destiny_id) AND (state_destiny_id=zone.id_state)
                            ORDER BY Shipments_Id
                            DESC LIMIT ".$limit."");*/
            }
   
}
